#include "fileexistshandledialog.h"
#include "ui_fileexistshandledialog.h"

FileExistsHandleDialog::FileExistsHandleDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FileExistsHandleDialog)
{
    ui->setupUi(this);
	setupSignals();
}

FileExistsHandleDialog::~FileExistsHandleDialog()
{
    delete ui;
}

void FileExistsHandleDialog::setupSignals()
{
	connect(ui->m_OverrideButton, SIGNAL(clicked()), this, SLOT(onOverride()));
	connect(ui->m_IgnoreButton, SIGNAL(clicked()), this, SLOT(onIgnore()));
	connect(ui->m_ContinueButton, SIGNAL(clicked()), this, SLOT(onContinue()));
}

void FileExistsHandleDialog::onOverride()
{
	m_ResponseCode = 1;
	accept();
}

void FileExistsHandleDialog::onIgnore()
{
	m_ResponseCode = 2;
	accept();
}

void FileExistsHandleDialog::onContinue()
{
	m_ResponseCode = 3;
	accept();
}

void FileExistsHandleDialog::setMessage(const QString &message)
{
	ui->m_MessageLabel->setText(message);
}

void FileExistsHandleDialog::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
